package net.peihuan.entity;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public class Article {
    private Integer articleid;

    private String title;

    private Integer categoryid;

    private Integer weight;

    private Integer click;

    private Date pubdate;

    private String content;

    //以上是数据库中的字段

    private List<Tag> tags;

    private Category category;

    private String digest;     //文章摘要

    private String grouptags;   //主页分页查询文章时，要获取一个文章的所有标签名字，对应视图中的`group_concat` 字段
    private String grouptags2; //和上面一样，只不过是alias


    public String getGrouptags2() {
        return grouptags2;
    }

    public void setGrouptags2(String grouptags2) {
        this.grouptags2 = grouptags2;
    }

    public String getGrouptags() {
        return grouptags;
    }

    public void setGrouptags(String grouptags) {
        this.grouptags = grouptags;
    }

    public String getDigest() {
        return digest;
    }

    public void setDigest(String digest) {
        this.digest = digest;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public List<Tag> getTags() {
        return tags;
    }

    public void setTags(List<Tag> tags) {
        this.tags = tags;
    }

    public Integer getArticleid() {
        return articleid;
    }

    public void setArticleid(Integer articleid) {
        this.articleid = articleid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getCategoryid() {
        return categoryid;
    }

    public void setCategoryid(Integer categoryid) {
        this.categoryid = categoryid;
    }

    public Integer getWeight() {
        return weight;
    }

    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    public Integer getClick() {
        return click;
    }

    public void setClick(Integer click) {
        this.click = click;
    }



    public String getDate(){
        String date="";
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        date= format.format(pubdate);
        return date;
    }
    //返回完整的时间，用来查找某篇文章的前一篇和后一篇
    public String getFulldate(){
        String date="";
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        date= format.format(pubdate);
        return date;
    }

    public void setPubdate(Date pubdate) {
        this.pubdate = pubdate;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}